import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import store from "@/store";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/login.vue"),
  },
  {
    path: "/board",
    name: "board",
    component: () => import("@/views/map/board.vue"),
  },
  {
    path: "/home",
    name: "home",
    component: HomeView,
    children: [
      {
        path: "index",
        component: () => import("../views/index/Index.vue"),
        meta: {
          thumb: [
            {
              text: "概况",
              to: "/home/index",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/map",
    name: "driverMap",
    component: HomeView,
    children: [
      {
        path: "driverMap",
        component: () => import("../views/map/driverMap.vue"),
        meta: {
          thumb: [
            {
              text: "司机点聚合地图",
              to: "/map/driverMap",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/messageCenter",
    name: "messageCenter",
    component: HomeView,
    children: [
      {
        path: "messageCenterList",
        component: () => import("../views/messageCenter/messageCenterList.vue"),
        meta: {
          //thumb: ["消息中心"],
          thumb: [
            {
              text: "消息中心",
              to: "/messageCenter/messageCenterList",
            },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "messageCenterList/Details",
        component: () =>
          import("../views/messageCenter/messageCenterListDetails.vue"),
        meta: {
          //thumb: ["消息中心","消息详情"],
          thumb: [
            {
              text: "消息中心",
              to: "/messageCenter/messageCenterList",
            },
            {
              text: "消息详情",
              to: "/messageCenter/messageCenterList/Details",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/Carrier",
    name: "Carrier",
    title: "货主管理",
    icon: "icon-huozhuguanli",
    component: HomeView,
    children: [
      {
        name: "carrierList",
        path: "acceptCarriage/list",
        component: () => import("../views/CargoOwner/acceptCarriage.vue"),
        meta: {
          thumb: [{ text: "承运货主", to: "/Carrier/acceptCarriage/list" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        name: "acceptCarriageDetails",
        path: "acceptCarriage/details/:ownerId",
        component: () =>
          import("../views/CargoOwner/acceptCarriageDetails.vue"),
        meta: {
          thumb: [
            { text: "承运货主", to: "/Carrier/acceptCarriage/list" },
            {
              text: "货主详情",
              to: "/Carrier/acceptCarriage/details/:ownerId",
            },
          ],
          keepAlive: false,
        },
      },
      {
        name: "acceptCarriage/AddCargoOwner",
        path: "acceptCarriage/AddCargoOwner",
        component: () => import("../views/CargoOwner/AddCargoOwner.vue"),
        meta: {
          thumb: [
            { text: "承运货主", to: "/Carrier/acceptCarriage/list" },
            { text: "新增货主", to: "/Carrier/acceptCarriage/AddCargoOwner" },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/supplierManagement",
    name: "supplierManagement",
    component: HomeView,
    children: [
      {
        path: "supplierList",
        component: () => import("../views/supplierManagement/supplierList.vue"),

        meta: {
          // thumb: ["供应商管理", "供应商列表"],
          thumb: [
            { text: "供应商列表", to: "/supplierManagement/supplierList" },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "certifiedSupplier",
        component: () =>
          import("../views/supplierManagement/certifiedSupplier.vue"),
        meta: {
          //thumb: ["供应商管理", "待认证供应商"],
          thumb: [
            {
              text: "待认证供应商",
              to: "/supplierManagement/certifiedSupplier",
            },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "certifiedSupplier/details/:supplierId",
        component: () =>
          import("../views/supplierManagement/certifiedSupplierDetails.vue"),
        meta: {
          //thumb: ["供应商管理", "待认证供应商", "认证详情"],

          thumb: [
            {
              text: "待认证供应商",
              to: "/supplierManagement/certifiedSupplier",
            },
            { text: "认证详情", to: "certifiedSupplier/details/:supplierId" },
          ],
          keepAlive: false,
        },
      },

      {
        path: "supplierList/details/:supplierId",
        component: () =>
          import("../views/supplierManagement/certifiedSupplierDetails.vue"),
        meta: {
          //thumb: ["供应商管理", "供应商列表", "供应商详情"],
          thumb: [
            { text: "供应商列表", to: "/supplierManagement/supplierList" },
            { text: "供应商详情", to: null },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "supplierList/addSupplier",
        component: () => import("../views/supplierManagement/addSupplier.vue"),
        meta: {
          //thumb: ["供应商管理", "供应商列表", "新增供应商"],
          thumb: [
            { text: "供应商列表", to: "/supplierManagement/certifiedSupplier" },
            { text: "新增供应商", to: null },
          ],
          keepAlive: false,
        },
      },

      {
        path: "supplierList/editSupplier",
        component: () => import("../views/supplierManagement/addSupplier.vue"),
        meta: {
          //thumb: ["供应商管理", "供应商列表", "编辑供应商"],
          thumb: [
            { text: "供应商列表", to: "/supplierManagement/supplierList" },
            {
              text: "编辑供应商",
              to: "/supplierManagement/supplierList/editSupplier",
            },
          ],
          keepAlive: false,
        },
      },

      {
        path: "operatorRequest",
        component: () =>
          import("../views/supplierManagement/operatorRequest.vue"),
        meta: {
          // thumb: ["供应商管理", "运营商建单请求"],
          thumb: [
            {
              text: "运营商建单请求",
              to: "/supplierManagement/operatorRequest",
            },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "operatorRequestDetails",
        component: () =>
          import("../views/supplierManagement/operatorRequestDetails.vue"),
        meta: {
          // thumb: ["供应商管理", "运营商建单请求"],
          thumb: [
            {
              text: "运营商建单请求",
              to: "/supplierManagement/operatorRequest",
            },
            {
              text: "订单详情",
              to: null,
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "assistcreatingOrder",
        component: () =>
          import("../views/supplierManagement/assistcreatingOrder.vue"),
        meta: {
          thumb: [
            {
              text: "平台协助建单",
              to: "/supplierManagement/assistcreatingOrder",
            },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "selfCreatedOrder",
        component: () =>
          import("../views/supplierManagement/selfCreatedOrder.vue"),
        meta: {
          thumb: [
            {
              text: "平台协助建单",
              to: "/supplierManagement/assistcreatingOrder",
            },
            {
              text: "创建订单",
              to: "/supplierManagement/selfCreatedOrder",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "updateOrder",
        component: () =>
          import("../views/supplierManagement/selfCreatedOrder.vue"),
        meta: {
          thumb: [
            {
              text: "平台协助建单",
              to: "/supplierManagement/assistcreatingOrder",
            },
            {
              text: "修改订单",
              to: "/supplierManagement/updateOrder",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "assistcreatingOrderDetail",
        component: () =>
          import("../views/supplierManagement/assistcreatingOrderDetail.vue"),
        meta: {
          thumb: [
            {
              text: "平台协助建单",
              to: "/supplierManagement/assistcreatingOrder",
            },
            {
              text: "修改订单",
              to: "/supplierManagement/assistcreatingOrderDetail",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/vehicle",
    name: "vehicle",
    component: HomeView,
    children: [
      // {
      //   path: "certAudit",
      //   component: () => import("../views/vehicle/certAudit.vue"),

      //   meta: {
      //     thumb: [{ text: "待认证车辆", to: "/vehicle/certAudit" }],
      //   },
      // },
      {
        path: "certAudit/details/:vehicleId",
        component: () =>
          import("../views/vehicle/subCertAudit/AuditDetails.vue"),
        meta: {
          //thumb: ["待认证车辆", "认证详情"],
          thumb: [
            { text: "车辆列表", to: "/vehicle/list" },
            { text: "认证详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "list",
        component: () => import("../views/vehicle/list.vue"),
        meta: {
          thumb: [{ text: "车辆列表", to: "/vehicle/list" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
    ],
  },
  {
    path: "/driver",
    name: "driver",
    component: HomeView,
    children: [
      {
        path: "list",
        component: () => import("../views/driver/driverList.vue"),
        meta: {
          thumb: [{ text: "司机列表", to: "/driver/list" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      // {
      //   path: "certAudit",
      //   component: () => import("../views/driver/driverCertAudit.vue"),

      //   meta: {
      //     thumb: [{ text: "待认证司机", to: "/driver/certAudit" }],
      //   },
      // },
      {
        path: "certAudit/details/:driverId",
        component: () => import("../views/driver/AuditDetails.vue"),
        meta: {
          thumb: [
            { text: "司机列表", to: "/driver/list" },
            { text: "认证详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "behavioralAppeal",
        component: () => import("../views/driver/behavioralAppeal.vue"),
        meta: {
          thumb: [{ text: "行为分申诉", to: "/driver/behavioralAppeal" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
    ],
  },
  {
    path: "/orderManagement",
    name: "orderManagement",
    component: HomeView,
    children: [
      {
        path: "CarrierOrder",
        component: () => import("../views/orderManagement/CarrierOrder.vue"),

        meta: {
          //thumb: ["订单管理", "承运订单"],
          thumb: [{ text: "承运订单", to: "/orderManagement/CarrierOrder" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "CarrierOrder/details",
        component: () =>
          import("../views/orderManagement/CarrierOrderDetails.vue"),

        meta: {
          //thumb: ["订单管理", "承运订单", "订单详情"],
          thumb: [
            { text: "承运订单", to: "/orderManagement/CarrierOrder" },
            { text: "订单详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "MatchOrders",
        component: () => import("../views/orderManagement/MatchOrders.vue"),

        meta: {
          //thumb: ["订单管理", "撮合订单"],
          thumb: [{ text: "撮合订单", to: "/orderManagement/MatchOrders" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "MatchOrders/details/:orderId/:orderStatus",
        component: () =>
          import("../views/orderManagement/MatchOrdersDetails.vue"),

        meta: {
          //thumb: ["订单管理", "撮合订单", "订单详情"],
          thumb: [
            { text: "撮合订单", to: "/orderManagement/MatchOrders" },
            { text: "订单详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "MatchSettlementOrder",
        component: () =>
          import("../views/orderManagement/MatchSettlementOrder.vue"),
        meta: {
          thumb: [
            { text: "撮合结算单", to: "/orderManagement/MatchSettlementOrder" },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "MatchCargoSettlement/Details/:id",
        component: () =>
          import("../views/orderManagement/MatchCargoSettlementDetails.vue"),
        meta: {
          thumb: [
            { text: "撮合结算单", to: "/orderManagement/MatchSettlementOrder" },
            {
              text: "货主结算单详情",
              to: "/orderManagement/MatchCargoSettlement/Details",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "MatchDriverSettlement/Details/:driverBillId",
        component: () =>
          import("../views/orderManagement/MatchDriverSettlementDetails.vue"),
        meta: {
          thumb: [
            { text: "撮合结算单", to: "/orderManagement/MatchSettlementOrder" },
            {
              text: "司机结算单详情",
              to: "/orderManagement/MatchDriverSettlement/Details",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "CarrierOrder/CreateCarrierOrder",
        component: () =>
          import("../views/orderManagement/CreateCarrierOrder.vue"),
        meta: {
          //thumb: ["订单管理", "承运订单", "创建订单"],
          thumb: [
            { text: "承运订单", to: "/orderManagement/CarrierOrder" },
            { text: "创建订单", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "CarrierOrder/editCarrierOrder",
        component: () =>
          import("../views/orderManagement/CreateCarrierOrder.vue"),
        meta: {
          thumb: [
            { text: "承运订单", to: "/orderManagement/CarrierOrder" },
            { text: "编辑订单", to: null },
          ],
          keepAlive: false,
        },
      },

      {
        path: "WaybillManagement",
        component: () =>
          import("../views/WaybillManagement/WaybillManagement.vue"),
        meta: {
          //thumb: ["订单管理", "运单管理"],
          thumb: [
            { text: "运单管理", to: "/orderManagement/WaybillManagement" },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        // waybillId
        path: "WaybillManagement/Details/:waybillId",
        component: () =>
          import("../views/WaybillManagement/WaybillManagementDetails.vue"),
        meta: {
          //thumb: ["订单管理", "运单管理", "运单详情"],
          thumb: [
            { text: "运单管理", to: "/orderManagement/WaybillManagement" },
            { text: "运单详情", to: null },
          ],
          keepAlive: false,
        },
      },

      // 承运结算单
      {
        path: "SettlementDoc",
        component: () => import("../views/SettlementDoc/SettlementDoc.vue"),
        meta: {
          //thumb: ["订单管理", "承运结算单"],
          thumb: [{ text: "承运结算单", to: "/orderManagement/SettlementDoc" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "SettlementDoc/details/:driverBillId",
        component: () =>
          import("../views/SettlementDoc/statementAccountDetails.vue"),
        meta: {
          //thumb: ["订单管理", "承运结算单", "承运结算单详情"],
          thumb: [
            { text: "承运结算单", to: "/orderManagement/SettlementDoc" },
            { text: "承运结算单详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "SettlementDoc/paymentOrderDetails/:id",
        component: () =>
          import("../views/SettlementDoc/paymentOrderDetails.vue"),
        meta: {
          //thumb: ["订单管理", "承运结算单", "付款单详情"],
          thumb: [
            { text: "承运结算单", to: "/orderManagement/SettlementDoc" },
            { text: "付款单详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "SettlementDoc/receiptDetails/:id",
        component: () => import("../views/SettlementDoc/receiptDetails.vue"),
        meta: {
          //thumb: ["订单管理", "承运结算单", "收款单详情"],
          thumb: [
            { text: "承运结算单", to: "/orderManagement/SettlementDoc" },
            { text: "收款单详情", to: null },
          ],
          keepAlive: false,
        },
      },
    ],
  },

  {
    path: "/contractManagement",
    name: "contractManagement",
    component: HomeView,
    children: [
      {
        path: "List",
        component: () => import("../views/contractManagement/contractList.vue"),
        meta: {
          //thumb: ["合同管理", "合同列表"],
          thumb: [{ text: "合同列表", to: "/contractManagement/List" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "CargoOwnerContract/Detail/:contractId",
        component: () =>
          import("../views/contractManagement/cargoOwnerContractDetails.vue"),
        meta: {
          //thumb: ["合同管理", "合同列表", "货主合同详情"],
          thumb: [
            { text: "合同列表", to: "/contractManagement/List" },
            {
              text: "货主合同详情",
              to: "/contractManagement/CargoOwnerContract/Detail/:contractId",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "supplierContract/Detail/:contractId",
        component: () =>
          import("../views/contractManagement/supplierContractDetails.vue"),
        meta: {
          //thumb: ["合同管理", "合同列表", "供应商合同详情"],
          thumb: [
            { text: "合同列表", to: "/contractManagement/List" },
            {
              text: "供应商合同详情",
              to: "/contractManagement/supplierContract/Detail/:contractId",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/dataStatistics",
    name: "dataStatistics",
    component: HomeView,
    children: [
      {
        path: "undrawns",
        component: () => import("../views/dataStatistics/undrawns.vue"),
        meta: {
          thumb: [{ text: "未提现数据统计", to: "/dataStatistics/undrawns" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "Cargostatistics",
        component: () => import("../views/dataStatistics/Cargostatistics.vue"),
        meta: {
          thumb: [
            { text: "货物数据统计", to: "/dataStatistics/Cargostatistics" },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "Coststatistics",
        component: () => import("../views/dataStatistics/Coststatistics.vue"),
        meta: {
          thumb: [{ text: "费用统计", to: "/dataStatistics/Coststatistics" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "dirver",
        component: () => import("../views/dataStatistics/dirver.vue"),
        meta: {
          thumb: [{ text: "费用统计", to: "/dataStatistics/dirver" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "brokerage",
        component: () => import("../views/dataStatistics/brokerage.vue"),
        meta: {
          thumb: [{ text: "佣金统计", to: "/dataStatistics/brokerage" }],
          keepAlive: true,
          scrollTop: 0,
        },
      }
      
    ],
  },

  {
    path: "/BasicSettings",
    name: "BasicSettings",
    component: HomeView,
    children: [
      {
        path: "roleManagement",
        component: () => import("../views/BasicSettings/RoleManagement.vue"),
        meta: {
          //thumb: ["基础设置", "角色管理"],
          thumb: [{ text: "角色管理", to: "/BasicSettings/roleManagement" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "Funding",
        component: () => import("../views/BasicSettings/Funding.vue"),
        meta: {
          //thumb: ["基础设置", "账号管理"],
          thumb: [{ text: "资金流水", to: "/BasicSettings/Funding" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "accountManagement",
        component: () => import("../views/BasicSettings/accountManagement.vue"),
        meta: {
          //thumb: ["基础设置", "账号管理"],
          thumb: [{ text: "账号管理", to: "/BasicSettings/accountManagement" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "staffManagement",
        component: () => import("../views/BasicSettings/staffManagement.vue"),
        meta: {
          //thumb: ["基础设置", "员工管理"],
          thumb: [{ text: "员工管理", to: "/BasicSettings/staffManagement" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "feedback",
        component: () => import("../views/BasicSettings/feedback.vue"),
        meta: {
          //thumb: ["基础设置", "意见反馈"],
          thumb: [{ text: "意见反馈", to: "/BasicSettings/feedback" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "billingRules",
        component: () => import("../views/BasicSettings/billingRules.vue"),
        meta: {
          //thumb: ["基础设置", "计费规则"],
          thumb: [{ text: "计费规则", to: "/BasicSettings/billingRules" }],
          keepAlive: true,
          scrollTop1: 0,
          scrollTop2: 0,
          scrollTop3: 0,
        },
      },
      {
        path: "personalSettings",
        component: () => import("../views/BasicSettings/personalSettings.vue"),
        meta: {
          thumb: [{ text: "个人设置", to: "/BasicSettings/personalSettings" }],
          keepAlive: false,
        },
      },
      {
        path: "insure",
        component: () => import("../views/BasicSettings/insure.vue"),
        meta: {
          thumb: [{ text: "保险管理", to: "/BasicSettings/insure" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "customerService",
        component: () => import("../views/BasicSettings/customerService.vue"),
        meta: {
          thumb: [{ text: "客服管理", to: "/BasicSettings/customerService" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "vehicleConfig",
        component: () => import("../views/BasicSettings/vehicleConfig.vue"),
        meta: {
          thumb: [{ text: "车型配置", to: "/BasicSettings/vehicleConfig" }],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "vehicleConfig/edit",
        component: () => import("../views/BasicSettings/vehicleConfigEdit.vue"),
        meta: {
          thumb: [
            { text: "车型配置", to: "/BasicSettings/vehicleConfig" },
            { text: "编辑车辆", to: "/BasicSettings/vehicleConfig/edit" },
          ],
          keepAlive: false,
        },
      },
      {
        name: "accountCreatAndBind",
        path: "accountCreatAndBind",
        component: () =>
          import("../views/BasicSettings/accountCreatAndBind.vue"),
        meta: {
          thumb: [
            {
              text: "账户创建与绑定",
              to: "/BasicSettings/accountCreatAndBind",
            },
          ],
          keepAlive: false,
        },
      },
      {
        name: "apiManagement",
        path: "apiManagement",
        component: () => import("../views/apiManagement/apiManagement.vue"),
        meta: {
          thumb: [
            {
              text: "Api管理",
              to: "/BasicSettings/apiManagement",
            },
          ],
          keepAlive: false,
        },
      },
      {
        name: "promotionCenter",
        path: "promotionCenter",
        component: () => import("../views/BasicSettings/promotionCenter.vue"),
        meta: {
          thumb: [
            { text: "推广中心列表", to: "/BasicSettings/promotionCenter" },
          ],
          keepAlive: true,
        },
      },
      {
        name: "Settings",
        path: "Settings",
        component: () => import("../views/BasicSettings/Settings/Settings.vue"),
        meta: {
          thumb: [{ text: "设置", to: "/BasicSettings/Settings" }],
          keepAlive: true,
        },
      },
      {
        name: "/home/dataOverview",
        path: "/home/dataOverview",
        component: () => import("../views/analysis/analysis.vue"),
        meta: {
          thumb: [
            {
              text: "数据概览",
              to: "/home/dataOverview",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/financialManagement",
    name: "financialManagement",
    component: HomeView,
    children: [
      {
        path: "selfOperatedBbusiness",
        component: () =>
          import("../views/financialManagement/selfOperatedBbusiness.vue"),
        meta: {
          //thumb: ["财务管理", "自营业务"],
          thumb: [
            {
              text: "自营业务",
              to: "/financialManagement/selfOperatedBbusiness",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "paymentRecordsDetails/:id",
        component: () =>
          import("../views/financialManagement/paymentRecordsDetails.vue"),
        meta: {
          // thumb: ["财务管理", "自营业务", "详情"],
          thumb: [
            {
              text: "自营业务",
              to: "/financialManagement/selfOperatedBbusiness",
            },
            { text: "详情", to: null },
          ],
          keepAlive: false,
        },
      },
      {
        path: "withdrawApply",
        component: () =>
          import("../views/financialManagement/withdrawApply.vue"),
        meta: {
          //thumb: ["财务管理", "提现申请"],
          thumb: [
            {
              text: "提现申请",
              to: "/financialManagement/withdrawApply",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "financialSettlement",
        component: () =>
          import("../views/financialManagement/financialSettlement.vue"),
        meta: {
          //thumb: ["财务管理", "财务结算"],
          thumb: [
            {
              text: "财务结算",
              to: "/financialManagement/financialSettlement",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "financialSettlement/Details",
        component: () =>
          import("../views/financialManagement/financialSettlementDetails.vue"),
        meta: {
          //thumb: ["财务管理", "财务结算","结算单详情"],
          thumb: [
            {
              text: "财务结算",
              to: "/financialManagement/financialSettlement",
            },
            {
              text: "结算单详情",
              to: null,
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
  {
    path: "/operationManagement",
    name: "operationManagement",
    component: HomeView,
    children: [
      {
        path: "coupon",
        component: () => import("../views/operationManagement/coupon.vue"),
        meta: {
          thumb: [
            {
              text: "优惠券管理",
              to: "/operationManagement/coupon",
            },
          ],
          keepAlive: true,
          scrollTop: 0,
        },
      },
      {
        path: "coupon/details",
        component: () =>
          import("../views/operationManagement/couponDetails.vue"),
        meta: {
          thumb: [
            {
              text: "优惠券管理",
              to: "/operationManagement/coupon",
            },
            {
              text: "优惠券详情",
              to: "/operationManagement/coupon/details",
            },
          ],
          keepAlive: false,
        },
      },
      {
        path: "coupon/add",
        component: () => import("../views/operationManagement/addCoupon.vue"),
        meta: {
          thumb: [
            {
              text: "优惠券管理",
              to: "/operationManagement/coupon",
            },
            {
              text: "新建优惠券",
              to: "/operationManagement/coupon/add",
            },
          ],
          keepAlive: false,
        },
      },
    ],
  },
];

const router = new VueRouter({
  routes,
  mode: "hash",
});

//全局进度条的配置
NProgress.configure({
  showSpinner: false, //加载微调器设置,默认为true
});
// 全局路由守卫
router.beforeEach((to, from, next) => {
  NProgress.start();
  let type = to.meta.permission;

  // if (to.path === "/Login") {
  //   // 清除本地储存token
  //   localStorage.clear();
  //   // 放行
  //   next();
  // } else if (to.meta.need_token === true) {
  //   let token = localStorage.getItem("token");
  //   if (token === "" || token === null) {
  //     next("/Login");
  //   } else {
  //     // 有token则放行
  //     next();
  //   }
  // } else {
  //   // 不需要验证
  // }
  next();
});
// 全局后置守卫
router.afterEach((to, from, next) => {
  NProgress.done();
  // console.log(NProgress.done());
  // console.log(111);
});

export default router;
